<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<link rel="stylesheet" href="__STATIC__/css/details.css" />
		
		<script src="__STATIC__/js/jquery-1.8.2.min.js">
			
		</script>
		<script>
			$(function(){
				$('.cattr').click(function(){
					$(this).addClass('red').siblings().removeClass('red');
					var len=$('.red').length;
					
					var lilen=$('form ul li').length;
					
					if(len>=lilen){
						var gid="{$hd.get.gid}";
						
						var id='';
						$.each($('.red'),function(){
							id +=$(this).attr('specId')+',';
						})
							$.ajax({
							type:"post",
							url:"{|U:'checkShoplist'}",
							data:{'id':id,'gid':gid},
							dataType:'json',
							success:function(phpData){
								if(phpData){
									$('.yes').show().siblings().hide();
								
                                    $('#cart').attr('sumattr',phpData['sumattr']);
                                    $('#cart').attr('shoplist_id',phpData['id']);
                                    $('#cart').attr('ispost',1);
                                    
									
									
								
									$('.add').click(function(){
									    var val=$(this).parents().find('input').val();
									    val=parseInt(val);
									    if(val<parseInt(phpData['kucun'])){
									    val=val+1;
										$(this).parents().find('input').val(val);
									    }
									    

					
				})

								}else{
									$('.no').show().siblings().hide();
									$('.minus').click(function(){
										var val=$(this).parents().find('input').val();
									    val=parseInt(val);
										if(val>1){
											val=val-1;
											$(this).parents().find('input').val(val);
											
										}
				})
								}
							}
                         
						})

						
					}

				})
				
//				加入购物车
              $('#cart').click(function(){
              	var ispost=$(this).attr('ispost');
              
              	if(ispost=="1"){
              		var sumattr=$(this).attr('sumattr');
              		
              		var shoplist_id=$(this).attr('shoplist_id');
              		
              		var gid="{$hd.get.gid}";
              		
              		var num=$('#num').val();
					
              		$.ajax({
              				type:"post",
							url:"{|U:'Cart/addCart'}",
							data:{'shoplist_id':shoplist_id,'gid':gid,'sumattr':sumattr,'num':num},
							dataType:'json',
							success:function(phpData){
								if(phpData=='1'){
									location.href="{|U:'Cart/index'}";
								}
								
							}
              			
              		})
              	}
              })



			})
		</script>
	</head>
	<body>
		<div class="top">
				<div class="topbar">
				
					<div class="left">
						<ul>
							<li class="logo">
		                     
						       <a href=""></a>
							</li>
							<li class="twofont"><a href="">商城</a></li>
							<li class="twofont"><a href="">手机</a></li>
							<li class="twofont"><a href="">配件</a></li>
							<li class="threefont"><a href="">体验店</a></li>
						</ul>
					
						
					</div>
					<div class="right">
						<ul>
							 <li class="login">
							    <span></span>
							 	<a href="">注册</a>
							 	<a href="">登录</a>
							 </li>
					       
					         <li class="cart">
					   	        <a href=""></a>
					         </li>
						</ul>
					  
						
					</div>
				</div>
		</div>
		<div class="deout">
			<div class="deleft">
				<div class="littleshoppic">
					<ul>
						<foreach from="$shopData['smallpic']" key="$k" value="$v">
						<li>
							<img src="__ROOT__/{$v}" alt=""  style="width:68px"/>
						</li>
						</foreach>
						
					</ul>
				</div>
				<div class="bigshoppic">
					<ul>
						<foreach from="$shopData['midpic']" key="$k" value="$v">
						<li>
						<img src="__ROOT__/{$v}" alt="" style="width:400px"/>	
						</li>
						</foreach>
					</ul>
					
				</div>
				
			</div>
			<div class="deright">
				<div class="salesprice">
					<span>
						商城价：
						<span>{$goodsData.shopprice}</span>
					</span>
				</div>
				<div class="selattr">
					<form action="" method="post">
						<ul>
							<foreach from="$resetData" key="$k" value="$v">
								<li>
									<span class="propertyname">
										选择{$v.propertyname}:
									</span>
									<foreach from="$v" key="$kk" value="$vv">
								    <if value="is_array($vv)">
									
											<span class="cattr" specId="{$vv.id}">
												
											    	{$vv.gavalue}
											   
											</span>
	
											
										
									</if>
									</foreach>
								</li>
							
								

						
							</foreach>
						</ul>

					

						
						<div class="goodsnum">
							<div class="buynum">
								购买数量：
							</div>
				        	
							<div class="outnum">
								<a href="javascript:;" class="minus">

								</a>
								<input type="text" value="1" id="num"/>
								<a href="javascript:;" class="add">

								</a>
							</div>

							
						</div>
						<div class="areatotal">
							
								<span class="yes pd" style="display:none">
									现在有您需要的商品
								</span>
								<span class="no pd" style="display:none">
									不好意思，还没有您选择的货品
								</span>
						
							
							
						</div>
						<!--点击加入购物车,并且发ajax到服务器，服务器端通过cart类存入购物车-->
						<a href="javascript:;" id="cart" ispost="0">加入购物车</a>
						
						
					</form>
				</div>
				
			</div>
		
			
		</div>

		<div class="proimg">
			<img src="__STATIC__/images/142660717185.jpg" alt="" />
		</div>
		<div class="proimg">
			<img src="__STATIC__/images/14266071728.jpg" alt="" />
		</div>
		<div class="proimg">
			<img src="__STATIC__/images/142660717221.jpg" alt="" />
		</div>	
		<div class="proimg">
			<img src="__STATIC__/images/14266071739.jpg" alt="" />
		</div>
		<div class="proimg">
			<img src="__STATIC__/images/142660717489.jpg" alt="" />
		</div>
		<div class="proimg">
			<img src="__STATIC__/images/142660717493.jpg" alt="" />
		</div>
		<div class="proimg">
			<img src="__STATIC__/images/142660717611.jpg" alt="" />
		</div>
						<div class="aboutus">
					<div class="alink">
						<a href="">关于我们</a>
						<a href="">联系我们</a>
						<a href="">新闻中心</a>
						<a href="">加入我们</a>
						<a href="">公益</a>
						<a href="">星空之约</a>
					</div>
					<p>
						2012-2015 努比亚 版权所有 粤ICP备10006213号-2 ICP经营许可证编号：粤B2-20120688深圳市市场监督管理局企业主体身份公示 努比亚技术有限公司
					</p>
					
					<div class="asright">
						<a href="" class="weather">
						</a>
						<a href="" class="phone">

						</a>
						<a href="" class="ewm">
						</a>
						<a href=""  class="service">
						</a>
						<span>
							
						</span>
					</div>
				</div>
	
	</body>
</html>
